{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.12"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3612jvsc74a57bd09e448ea22042ddd26567fb390bbbe4eeefe3b92c7642735c8d963670b078654d",
   "display_name": "Python 3.6.12 64-bit ('common': conda)"
  },
  "metadata": {
   "interpreter": {
    "hash": "9e448ea22042ddd26567fb390bbbe4eeefe3b92c7642735c8d963670b078654d"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "\n",
    "https://blog.csdn.net/io569417668/article/details/106295308\n",
    "\n"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "\n",
    "## ply文件读取三角网格数据并且打印它的顶点和三角形。\n",
    "open3d有一种被称为TriangleMesh的3d三角网格的数据结构。下面的代码展示了如何从一个ply文件读取三角网格数据并且打印它的顶点和三角形。\n",
    "\n",
    "\n",
    "TriangleMesh类是有像vertices（顶点）和triangles（三角形）这些数据字段的。open3d通过numpy直接对这些字段进行访问。\n",
    "\n"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Testing mesh in open3d ...\nTriangleMesh with 1440 points and 2880 triangles.\nVertices:\n[[  4.51268387  28.68865967 -76.55680847]\n [  7.63622284  35.52046967 -69.78063965]\n [  6.21986008  44.22465134 -64.82303619]\n ...\n [-22.12651634  31.28466606 -87.37570953]\n [-13.91188431  25.4865818  -86.25827026]\n [ -5.27768707  23.36245346 -81.43279266]]\nTriangles:\n[[   0   12   13]\n [   0   13    1]\n [   1   13   14]\n ...\n [1438   11 1439]\n [1439   11    0]\n [1439    0 1428]]\n"
     ]
    }
   ],
   "source": [
    "import open3d as o3d\n",
    "import open3d_tutorial as o3dtut\n",
    "import numpy as np\n",
    "\n",
    "print(\"Testing mesh in open3d ...\")\n",
    "mesh = o3dtut.get_knot_mesh()  # 加载03点云/knot.ply文件\n",
    "print(mesh)\n",
    "print('Vertices:')\n",
    "print(np.asarray(mesh.vertices)) # vertices（顶点）和triangles（三角形）\n",
    "print('Triangles:')\n",
    "print(np.asarray(mesh.triangles)) # vertices（顶点）和triangles（三角形）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}